package it.unibo.mycruise.chief;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.concurrent.CopyOnWriteArrayList;

import it.unibo.convoycruisecontrol.chiefboatsubsystem.IFlagDisplay;

/**
 * @author ale
 * @version 1.0
 * @created 24-ott-2012 00:48:19
 */
public class FlagDisplay extends Observable implements IFlagDisplay {

	private List<Boolean> boatStatuses;

	public FlagDisplay(int boatNumber)
	{
		this.boatStatuses = new ArrayList<Boolean>();
		for (int i = 0; i < boatNumber; i++)
		{
			boatStatuses.add(false);
		}
	}

	/**
	 * 
	 * @param seqPosition
	 */
	public void setFlag(int seqPosition){
		boatStatuses.set(seqPosition, true);
		setChanged();
		notifyObservers();
	}

	/**
	 * 
	 * @param seqPosition
	 */
	public void clearFlag(int seqPosition){
		boatStatuses.set(seqPosition, false);
		setChanged();
		notifyObservers();
	}

	public List<Boolean> getDisplayedFlags(){
		return boatStatuses;
	}
}